﻿
@{
    ViewBag.Title = "Apply";
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>代理申请</title>
    <link href="/css/style.css" rel="stylesheet" />
    <link href="/css/swipper.css" rel="stylesheet" />
    <link href="/css/preload.css" rel="stylesheet" />
    <link href="/css/loading.css" rel="stylesheet" />
    <script>
        var deviceWidth = document.documentElement.clientWidth;
        if (deviceWidth > 750) deviceWidth = 750;
        document.documentElement.style.fontSize = deviceWidth / 7.5 + "px";
        document.documentElement.style.width = "100%";
    </script>
    <script src="/js/htool.js"></script>
    <script src="/js/asynloading.js"></script>
</head>
<body>
    <div id="containter" class="container">
        <div style="width:100%"><img src="http://cs.youqi18.com/attachment/images/3/2017/02/CiHvN66k5MHKWKf6aHpHKXvMfWwzWa.jpg" width="100%"></div>
        <div class="user_toptip">*请认真填写，避免审核不通过</div>
        <div class="personData">
            <form id="form_info">
                <ul>
                    <li class="headerportrait">
                        <span>蒋承甫</span>
                        <div class="personData-pic">
                            <img src="http://wx.qlogo.cn/mmopen/ajNVdqHZLLCcoib43OMZZibyjKtLkIyATRSZJ9iaJfPn71joPVRQSRiaTcWcHVMKcib3FBuyuoHGPGIDkJM81c4wufg/132">
                        </div>
                        <div class="arrow"></div>
                    </li>
                    <!--li>
                    <span>会员等级</span>
                    <span class="userdataname">省钱</span>
                    </li-->
                    <input type="hidden" name="orderno" id="orderno">
                    <input type="hidden" name="orderid" id="orderid">
                    <li>
                        <span><em class="mustmhao">*</em>微信号<em class="mustt">(必填)</em></span>
                        <span class="userdataname userdatanamewx"><input type="text" name="weixin" id="weixin" value="" placeholder="请输入微信号" class="user_wx"></span>
                    </li>
                    <li>
                        <span><em class="mustmhao">*</em>支付宝<em class="mustt">(必填)</em></span>
                        <span class="userdataname userdatanamephone"><input type="text" name="zfbuid" id="zfbuid" value="" placeholder="提现使用" class="user_phone"></span>
                    </li>

                    <li>
                        <span><em class="mustmhao">*</em>姓名<em class="mustt">(必填)</em></span>
                        <span class="userdataname userdatanamephone"><input type="text" name="tname" id="tname" value="" placeholder="请输入姓名" class="user_phone"></span>
                    </li>
                    <li>
                        <span><em class="mustmhao">*</em>手机号码<em class="mustt">(必填)</em></span>
                        <span class="userdataname userdatanamephone"><input type="text" id="tel" name="tel" value="0" placeholder="请输入手机号码" class="user_phone"></span>
                    </li>
                    <li>
                        <span><em class="mustmhao">*</em>申请理由<em class="mustt">(必填)</em></span>
                        <span class="userdataname userdatanamephone">
                            <input type="text" name="dlmsg" id="dlmsg" value="" placeholder="" class="user_phone">
                        </span>
                    </li>
                </ul>
            </form>
            <style>
                .flow-an {
                    display: block;
                    height: 45px;
                    width: 7rem;
                    font-size: 16px;
                    margin: 15px auto;
                    color: #fff;
                    background: #cecece;
                    border-radius: 0.1rem !important;
                    font-weight: bold;
                    position: relative;
                    z-index: 1;
                }

                .flow-anurl {
                    display: block;
                    height: 45px;
                    line-height: 45px;
                    text-align: center;
                    width: 7rem;
                    font-size: 16px;
                    margin: 15px auto;
                    color: #fff;
                    background: #5cb85c;
                    border-radius: 0.1rem !important;
                    font-weight: bold;
                    position: relative;
                    z-index: 1;
                }
            </style>


            <input type="button" id="pay_submit" class="flow-btn" value="支付(1元)申请开通" />


        </div>
    </div>
</body>
</html>
<script src="/js/jquery-1.7.2.min.js"></script>
<script src="/js/idangerous.swiper.min.js"></script>
<script src="/js/common_phone.js"></script>
<script src="/js/fun.js"></script>


<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    window.sysinfo = window.sysinfo || { "uniacid": 3, "acid": "3", "siteroot": "http:\/\/cs.youqi18.com\/", "siteurl": "http:\/\/cs.youqi18.com\/app\/index.php?i=3&c=entry&do=dlreg&m=tiger_wxdaili", "attachurl": "http:\/\/cs.youqi18.com\/attachment\/", "cookie": { "pre": "e122_" }, "openid": "oEujHwZdrQSBE3dmLZ-p4w_AJXm0", "MODULE_URL": "http:\/\/cs.youqi18.com\/addons\/tiger_wxdaili\/" } || {};

    // jssdk config 对象
    jssdkconfig = { "appId": "wxd56c60dea7440144", "nonceStr": "k42yCFEII4UzQ0X7", "timestamp": "1495098704", "signature": "b25c02616442ec0578b576a6d562c435c63c4a2a" } || {};

    // 是否启用调试
    jssdkconfig.debug = false;

    jssdkconfig.jsApiList = [
		'checkJsApi',
		'onMenuShareTimeline',
		'onMenuShareAppMessage',
		'onMenuShareQQ',
		'onMenuShareWeibo',
		'hideMenuItems',
		'showMenuItems',
		'hideAllNonBaseMenuItem',
		'showAllNonBaseMenuItem',
		'translateVoice',
		'startRecord',
		'stopRecord',
		'onRecordEnd',
		'playVoice',
		'pauseVoice',
		'stopVoice',
		'uploadVoice',
		'downloadVoice',
		'chooseImage',
		'previewImage',
		'uploadImage',
		'downloadImage',
		'getNetworkType',
		'openLocation',
		'getLocation',
		'hideOptionMenu',
		'showOptionMenu',
		'closeWindow',
		'scanQRCode',
		'chooseWXPay',
		'openProductSpecificView',
		'addCard',
		'chooseCard',
		'openCard'
    ];

    wx.config(jssdkconfig);

</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#pay_submit").click(function () {
            $("#pay_submit").attr("value", '提交中请稍候……');//填充内容
            var val1 = $("#weixin").val();
            var val2 = $("#tel").val();
            var val3 = $("#dlmsg").val();
            var val4 = $("#zfbuid").val();
            if (!val1) {
                alert('请正确输入微信号');
                return;
            }
            if (!val4) {
                alert('支付宝帐号必须填写');
                return;
            }
            if (!val3) {
                alert('请填写申请理由');
                return;
            }
            if (!val2) {
                alert('请输入11位手机号码');
                return;
            }
            var myreg = /^\d{11}$/;
            if (!myreg.test(val2)) {
                alert('请输入正确的手机号码');
                return;
            }

            $.ajax({
                type: 'POST',
                data: $("#form_info").serialize(),
                url: './index.php?i=3&c=entry&do=Getpay&m=tiger_wxdaili',
                success: function (data) {
                    var json = eval("(" + data + ")");
                    //alert(json.orderno);
                    //alert(data.errmsg);

                    if (json.errcode == 0) {
                        $("#orderno").val(json.orderno);
                        $("#orderid").val(json.orderid);
                        wx.chooseWXPay({
                            timestamp: json.timeStamp,
                            nonceStr: json.nonceStr,
                            package: json.package,
                            signType: json.signType,
                            paySign: json.paySign,
                            success: function (res) {
                                //alertFun(json.package);
                                // 支付成功后的回调函数
                                var str = JSON.stringify(res);
                                checkorder();
                            }
                        });
                    } else {
                        //tips(json.errmsg);
                        //runEffect(json.errmsg);
                        alert(json.errmsg);
                    }
                }
            });


        });


        function checkorder() {

            var orderno = $("#orderno").val();
            var orderid = $("#orderid").val();
            if (orderno.length == 0) {
                alert('订单号为空');
                //alertFun('订单号为空');

            }
            $.ajax({
                type: 'POST',
                data: $("#form_info").serialize(),
                url: './index.php?i=3&c=entry&do=CheckJsPayResult&m=tiger_wxdaili',
                success: function (data) {
                    var json = eval("(" + data + ")");
                    if (json.errcode == 0) {
                        //alertToUrl(json.msg,json.url);
                        location.reload();
                    } else {
                        //alert(json.errmsg);
                        //clearInterval(run)
                        checkorder();
                    }
                }
            });
        }

    });


</script>
<script>
    $(function () {
        $(document).delegate("#btn_submit", "click", function () {
            var val1 = $("#weixin").val();
            var val2 = $("#tel").val();
            var val3 = $("#dlmsg").val();
            if (!val1) {
                alert('请正确输入微信号');
                return;
            }
            if (!val3) {
                alert('请填写申请理由');
                return;
            }
            if (!val2) {
                alert('请输入11位手机号码');
                return;
            }
            var myreg = /^\d{11}$/;
            if (!myreg.test(val2)) {
                alert('请输入正确的手机号码');
                return;
            }
            $.ajax({
                type: "post",
                url: "./index.php?i=3&c=entry&id=2990&do=dlreg&m=tiger_wxdaili",
                data: $("#form_info").serialize(),
                async: false,
                dataType: "json",
                success: function (result) {
                    if (result.statusCode == 200) {
                        alert(result.msg);
                        if ("" == "") {
                            window.location.href = "./index.php?i=3&c=entry&id=2990&do=dlreg&m=tiger_wxdaili";
                        }
                        else {
                            window.location.href = "./index.php?i=3&c=entry&id=2990&do=dlreg&m=tiger_wxdaili";
                        }
                    } else {
                        alert(result.msg);
                    }
                }
            });
        });
    });
</script>
